﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DTO;
using BUS;

namespace GUI
{
    public partial class frmThongKe : Form
    {
        public frmThongKe()
        {
            InitializeComponent();
        }

        private void btnThongKe_Click(object sender, EventArgs e)
        {
            DateTime tungay = dtpTuNgay.Value;
            DateTime denngay = dtpDenNgay.Value;

            ThongKeBUS bus = new ThongKeBUS();
            List<ThongKeDTO> ds = bus.ThongKe(tungay, denngay);
            int stt = 1;
            double tongtien = 0;
            dgvThongKe.Rows.Clear();
            for (int i = 0; i < ds.Count; i++)
            {
                dgvThongKe.Rows.Add(stt, ds[i].MaMatHang, ds[i].TenMatHang, ds[i].MaXuatXu, ds[i].SoLuongBan, ds[i].DoanhThu + " VNĐ");
                stt++;
                tongtien = tongtien + ds[i].DoanhThu;
            }
            txtDoanhThu.Text = tongtien.ToString() + " VNĐ";
        }

        private void btnIn_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Chức năng chưa hoàn thành ^^!");
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }


    }
}
